import java.util.ArrayList;


public class ArrayListInteger {
	public static void main(String[] args) throws InterruptedException {
		long j;
		System.gc();
		j = Runtime.getRuntime().freeMemory();
		ArrayList<Integer> list = new ArrayList();
		for (int i = 0; i < 1000; i++) {
			list.add(i);
		}
		System.gc();
		System.out.println(j-Runtime.getRuntime().freeMemory());
		Thread.sleep(1000);
		System.gc();
		j = Runtime.getRuntime().freeMemory();
		System.out.println(j);
		ArrayList<Integer> list1 = new ArrayList();
		for (int i = 0; i < 1000; i++) {
			list.add(i);
		}
		System.gc();
		System.out.println(j-Runtime.getRuntime().freeMemory());
	}
}
